<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>条件渲染</h2>
      <!-- v-if和v-else和v-else-if是紧挨着的 -->
      <p v-if="show">Vue is awesome!</p>
      <p v-else>Oh no 😢</p>

      <hr />

      <p v-if="type === 1">a</p>
      <p v-else-if="type === 2">b</p>
      <p v-else>c</p>

      <hr />

      <!-- template相当于是一个空的占位的标签 -->
      <template v-if="show2">
        <p>Vue is awesome!</p>
        <p>Vue is nb!</p>
        <p>Vue is wocao!</p>
      </template>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;

      createApp({
        data() {
          return {
            show: false,
            type: 1,
            show2: true,
          };
        },
      }).mount("#app");
    </script>
  </body>
</html>
